package com.joysuch.wwyt.edu.enums;

/**
 * 培训人脸识别
 */
public enum TrainingOpenFace {

    UN_OPEN_FACE(0, "未开启人脸识别"), OPEN_FACE(1, "开启人脸识别");
    private int id;
    private String name;

    TrainingOpenFace(int id, String name) {
        this.id = id;
        this.name = name;
    }

    public int getId() {
        return id;
    }

    public String getName() {
        return name;
    }

    public static TrainingOpenFace findByName(String name) {
        TrainingOpenFace[] values = TrainingOpenFace.values();
        for (TrainingOpenFace v : values) {
            if (v.getName().equals(name)) {
                return v;
            }
        }
        return null;
    }

    public static TrainingOpenFace findById(Integer level) {
        TrainingOpenFace[] values = TrainingOpenFace.values();
        for (TrainingOpenFace v : values) {
            if (v.getId() == level) {
                return v;
            }
        }
        return null;
    }

    public static String findNameById(Integer id) {
        if (id == null) {
            return null;
        }
        TrainingOpenFace[] values = TrainingOpenFace.values();
        for (TrainingOpenFace v : values) {
            if (v.getId() == id) {
                return v.getName();
            }
        }
        return null;
    }
}
